/*
 * Copyright (C) 2025 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

// Primitive types
export const FortyTwo: number = 42

export const hiStr: string = 'Hi'

export const FortyTwoN: bigint = 42n

export const bolTrue: boolean = true

export const boxA: Number = new Number(42)

export const boxB: String = new String('Hi')

export const boxC: BigInt = BigInt("42");

export const boxD: Boolean = new Boolean(true)

export const str: string = 'Hi'

export const str2: string = 'Hello, World!'

export const str3: string = '  Hello, World!  '

export const str4: string = 'abc'

export const str5: string = ''

export const str6: string = 'apple,banana;cherry orange'

export const str7: string = 'Hello'

export const str8: string = 'World'

export let str9: string | undefined | null = 'arkTs'

export const illegalUnicodeStr1: string = '\udc04';

export const illegalUnicodeStr2 = '\ud83d';

export const illegalUnicodeStr3 = '\udff4';

export type Greeting = '"Hello"'

export const strLiteral: '"Hello"' = '"Hello"'

export const strLiteral1: Greeting = '"Hello"'

export type Greeting2 = 'Hi'

export const strLiteral3: 'Hi' = 'Hi'

export const strLiteral4: Greeting2 = 'Hi'

export const strLiteral5: Greeting2 | Greeting = 'Hi'

export const strLiteral6: Greeting2 | Greeting = '"Hello"'

export type Role = 'admin' | 'user' | 'guest'

export type Color = 'red' | 'green' | 'blue';

export enum UserRole {
  Admin = 'admin',
  Editor = 'editor',
  Viewer = 'viewer',
  Guest = 'guest'
}

export enum UserRoleSingle {
  Admin = 'admin'
}

export enum ColorSet {
  White = 1,
  Grey = 2,
  Black = 3
}

export enum ColorSetSingle {
  White = 1
}

export const enum Animals {
  Dog,
  Cat,
  Bird
}

export class ClassNum {
  a: number = 0
  protected b: number = 1
  private c: number = 2
}

export type DiffTypeTuples = [number, string, boolean]

export type OptionalTuples = [number, boolean, string?]

export type VariableTuples = [string, ...string[]]

export const optionalTuples: OptionalTuples = [1, true, 'a']

export const sameTypeTuples: [string, string, string] = ['a', 'b', 'c']

export const diffTypeTuples: [number, string, boolean] = [1, 'a', true]

export type Union = number | string

export let unionNum: Union = 123

export interface Person {
  name: string;
  age: number;
}

export interface Animal {
  name: string;
  species: string;
}

export type Entity = Person | Animal;

export function foo(n?: number) {
  return n
}

export function funFoo(a: number, n?: number, s?: string) {
  return n
}

export class ClassStatic {
  static foo(n?: number) {
    return n
  }

  bar(n?: number) {
    return n
  }
}

export interface Iface {
  foo: (n?: number) => number | undefined
}

export interface User {
  id: number;
  name?: string;
  email?: string;
}

export function errorFunction(msg: string): never {
  throw new Error(msg)
}